package my.li.zhcsmedicalpayfront.controller;

import Vo.Manger;
import Vo.MedicalPay;

import land.MangerFeiginInteger;
import land.MedicalPayInterface;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import page.PageBean;
import util.JsonResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/medical")
public class MedicalPayController {

    private MedicalPayInterface medicalPayInterface;


    @RequestMapping("/")
    public String frist(HttpSession session){

        System.out.println("===========================================");

        session.setAttribute("medicalPays",new ArrayList<MedicalPay>());
        session.setAttribute("pagebean",new PageBean());
        return "medicalpay_manager";
    }

    @RequestMapping("/getAll")
    public String getAllMes(PageBean pageBean, HttpServletRequest request){
        System.out.println("======================= 进行分页查询");
        HttpSession session = request.getSession();
        session.setAttribute("pagebean",pageBean);

        List<MedicalPay> medicalPays = new ArrayList<>();
        session.setAttribute("medicalPays",medicalPays);
        return "medicalpay_manager";
    }

    @RequestMapping("/getByName")
    @ResponseBody
    public JsonResult queryById(MedicalPay medicalPay){
//        util.JsonResult jsonResult = new util.JsonResult();
        System.out.println("medicalPay :  "+medicalPay);
        return JsonResult.successWithoutData();
    }


    @RequestMapping("/add")
    @ResponseBody
    public JsonResult addMedicalPay(MedicalPay medicalPay){
        JsonResult jsonResult = new JsonResult();
        System.out.println("add : "+medicalPay);
        return JsonResult.successWithoutData();
    }

    @RequestMapping("/edit")
    @ResponseBody
    public JsonResult editMedical(MedicalPay medicalPay){
        JsonResult jsonResult = new JsonResult();
        System.out.println("edit : "+medicalPay);
        return JsonResult.successWithoutData();
    }


    @RequestMapping("/medicalpay_edit")
    public String getAdd(MedicalPay medicalPay){
//
        //查询
        System.out.println(medicalPay);
        return "medicalpay_edit";
    }

    @RequestMapping("/deleteById")
    @ResponseBody
    public JsonResult deleteByMedicalPayId(MedicalPay medicalPay) {

        System.out.println("删除"+medicalPay);
        return JsonResult.successWithoutData();
    }


}
